home *** CD-ROM | disk | FTP | other *** search
- on setPage p
- set the text of cast "Page" to string(p)
- return p
- end
-
- on initPage
- global gResponseOrder, gChallengeOrder, gChallengeIndex, gFlowType, gWorth, gPage, gPageScore
- if inChallenge() and (gFlowType <> #SCRAMBLE) and (gFlowType <> #sms) then
- subtractPageScore(gPage)
- end if
- set gWorth to 4
- set gPageScore to 0
- set gChallengeOrder to line random(24) of the text of cast "Rand 4 List"
- set gResponseOrder to "1234"
- set gChallengeIndex to 1
- end
-
- on doPage blindfold, Cycle, mode, timer
- global gStopTicks, gTimerTicks
- if blindfold and inChallenge() then
- hideAllResponses()
- drawChallenge()
- giveChallenge()
- hideChallenge()
- drawAllResponses()
- if Cycle then
- go(mode & "cycle")
- end if
- else
- if inChallenge() then
- drawAllResponses()
- drawChallenge()
- giveChallenge()
- else
- drawAllResponses()
- end if
- if Cycle then
- go(mode & "cycle")
- end if
- end if
- if timer and Cycle then
- set gStopTicks to -1
- else
- set gStopTicks to the ticks + gTimerTicks
- end if
- end
-
- on changeScreen adj
- global gPage, gNumPages, gScreenMode, gDictNum
- set newPg to gPage
- if ((newPg + adj) <= gNumPages) and ((newPg + adj) >= 1) then
- if getaProp(gScreenMode, #SNDRESP) <> #NONE then
- normalCenterSpeaker()
- end if
- if getaProp(gScreenMode, #SPECIAL) = #DICT then
- hideDict()
- hideTextPuppets()
- hide6()
- set gDictNum to 0
- end if
- set newPg to setPage(newPg + adj)
- updateStage()
- if the stillDown then
- repeat while the lastClick < 30
- nothing()
- end repeat
- set nextTime to the ticks + 18
- repeat while the stillDown
- if (the ticks > nextTime) and ((newPg + adj) <= gNumPages) and ((newPg + adj) >= 1) then
- set newPg to setPage(newPg + adj)
- set nextTime to the ticks + 18
- end if
- updateStage()
- end repeat
- end if
- hideOverlay()
- endOfPage(newPg)
- end if
- end
-
- on doFirstState newState
- global gPage, gMode, initGlobals, gNextPage, initGlobals, gSMSAllowBrowse, gNextChap, gBlindfold, gNextUnit, gNewChap, gTest, gNextPathList
- set act to getaProp(newState, #action)
- if act = #finishedAll then
- set goto to "endScreen"
- else
- if act = #finishedTest then
- set goto to "endScreen"
- else
- if act = #enterTest then
- clearScore()
- set gTest to 1
- end if
- end if
- end if
- if (act = #normal) or (act = #enterTest) then
- set mode to getaProp(newState, #mode)
- set m to value(mode)
- if m = 0 then
- if mode = "A" then
- set m to 13
- else
- if mode = "B" then
- set m to 14
- else
- if mode = "C" then
- set m to 15
- end if
- end if
- end if
- end if
- set mode to getAt(["122", "120", "102", "121", "112", "211", "210", "201", "221", "212", "021", "012", "111", "110", "011"], m)
- translateMode(mode)
- set gBlindfold to getaProp(newState, #blindfold)
- set uc to mapUnitChap(getaProp(newState, #nextunitchap))
- set gNextUnit to getaProp(uc, #unit)
- set gNextChap to getaProp(uc, #chapter)
- set uc to mapUnitChap(getaProp(newState, #unitchap))
- set unit to getaProp(uc, #unit)
- set chapter to getaProp(uc, #chapter)
- set language to getaProp(newState, #language)
- set gNextPathList to findChapPaths(language, gNextUnit, gNextChap)
- set prevChap to gNewChap
- set gNewChap to makeChapStr(language, unit, chapter)
- if gNewChap <> prevChap then
- if newChap() then
- set gNewChap to EMPTY
- set goto to "error"
- end if
- end if
- if (goto <> "endScreen") and (goto <> "error") then
- set gPage to setPage(getaProp(newState, #page))
- set gNextPage to getaProp(newState, #nextPage)
- set gSMSAllowBrowse to getaProp(newState, #allowBrowse)
- set goto to gMode
- end if
- end if
- return goto
- end
-
- on endOfPage newPg
- global gPage, gNumPages, gFlowType, gMode, gBlindfold, gNexQuad, gCycle, gTimer, gNextPage, gNextUnit, gNextChap, gCurQuad, gPageScore
- set ret to 1
- set goto to EMPTY
- set oldMode to gMode
- if gFlowType = #sms then
- if (gPageScore = 10) or isBrowse() then
- set allright to #wasRight
- else
- set allright to #wasWrong
- end if
- set newState to getSMSNextMode(allright)
- set goto to doFirstState(newState)
- if goto = "error" then
- set goto to "endScreen"
- end if
- else
- if gFlowType = #SCRAMBLE then
- translateMode(randMode())
- set gBlindfold to random(4) = 1
- set gPage to setPage(gNextPage)
- set gNextPage to randPage(gNextPage)
- set goto to gMode
- else
- if newPg > gNumPages then
- set goto to "endScreen"
- else
- set gPage to setPage(newPg)
- set gNextPage to (gPage mod 10) + 1
- set goto to gMode & "loop"
- end if
- end if
- end if
- if goto <> "endScreen" then
- initPage()
- checkLoad()
- newPage(gNexQuad, gNextUnit, gNextChap, gNextPage)
- end if
- if tail(goto, 4) = "loop" then
- set notBlind to not gBlindfold or isBrowse()
- set show to notBlind and (pictMode() = #response)
- if show then
- hideChallenge()
- hideAllResponses()
- setResponsePicts(getQuadBase(gCurQuad))
- end if
- if inChallenge() then
- if (gFlowType <> #SCRAMBLE) and (gFlowType <> #sms) then
- subtractPageScore(gPage)
- end if
- drawText()
- doPage(gBlindfold, gCycle, gMode, gTimer)
- if gCycle then
- set goto to gMode & "cycle"
- end if
- else
- drawText()
- end if
- else
- stopMouseTrap()
- end if
- if gMode <> oldMode then
- goChangeMeta("initPlay")
- else
- if goto = "endScreen" then
- goChangeMeta(goto)
- else
- go(goto)
- end if
- end if
- end
-